home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / CoreGateway / Recipient.cp < prev    next >
Encoding:
Text File  |  1995-07-28  |  4.0 KB  |  210 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Recipient.cp
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __BLJSTANDARDINCLUDES__
  15. #include "BLJStandardIncludes.h"
  16. #endif
  17.  
  18. #ifndef __BLJOCEUTILITIES__
  19. #include "BLJOCEUtilities.h"
  20. #endif
  21.  
  22. #ifndef __DEBUGGINGGEAR__
  23. #include  "DebuggingGear.h" 
  24. #endif
  25.  
  26. #ifndef __RECIPIENT__
  27. #include "Recipient.h"
  28. #endif
  29.  
  30. #pragma segment TRecipient
  31.  
  32. ImplementList(TRecipient,TRecipientList,true);
  33.  
  34. /***********************************|****************************************/
  35.  
  36. ostream& TRecipient::Describe(ostream& s) const
  37. {
  38.     TRString            name, type;
  39.     
  40.     if (this == nil) {
  41.         s << "TRecipient: nil" << flush;
  42.         return s;
  43.     }
  44.  
  45.     if (GetRecipientName (name)) {
  46.         s << name << " ";
  47.     }
  48.     
  49.     if (keithFlag.Flag(4) && GetRecipientType (type)) {
  50.         s << "<" << type << "> ";
  51.     }
  52.     
  53.     if (GetResponsible())
  54.         s << "(R) " << flush;
  55.     else
  56.         s << "(N) " << flush;
  57.  
  58.     if (keithFlag.Flag(4)) {
  59.         CreationID            cid;
  60.         if (keithFlag.Flag(4) && GetCID(cid)) {
  61.             s << cid << flush;
  62.         }
  63.  
  64.         if ( IsPathInfoPresent () )
  65.         {
  66.             {    unsigned long dNode;
  67.                 if (GetPathDNode(dNode)) {
  68.                     s << "dNode=" << dNode << " " << flush;
  69.                 }
  70.                 else 
  71.                 {
  72.                     unsigned short pathCount = GetPathNameCount();
  73.                     s << "'" << flush;
  74.                     for (short index = 1; index <= pathCount; ++index) {
  75.                         TRString        r;
  76.                         GetPathNameItem (index, r);
  77.                         s << r << ":" << flush;
  78.                     }
  79.                     s << "'" << flush;
  80.                 
  81.                     s << endl;
  82.                 }
  83.             }
  84.             
  85.             if ( IsPathInfoOptional () )
  86.                 s << "(Optional) ";
  87.         }
  88.         else
  89.         {
  90.             s << "(No path) ";
  91.         }
  92.  
  93.         {    DirectoryName    directoryName;
  94.             if (GetDirectoryName(directoryName))
  95.                 s << " (" << directoryName << ") " << flush;
  96.         }
  97.         
  98.         if ( IsAddressTypePresent() )
  99.         {
  100.             {    OSType            addressType = GetAddressType();
  101.             
  102.                 s << "'"; OutputOSType (s, addressType); s << "' " << GetExtensionDataSize() << " " << flush;
  103.             }
  104.             
  105.             {    char    buffer[48];
  106.                 GetExtensionData (0, (void *) buffer, 48);
  107.         
  108.                 s << "xtnValue=<";
  109.                 
  110.                 for (int i = 0; i < GetExtensionDataSize(); ++i) {    
  111.                     unsigned char c = *(buffer + i);
  112.                     
  113.                     if (c < 0x80) {
  114.                         switch (c) {
  115.                             case 0:    s << "^@"; break;
  116.                             case 10: s << "<lf>"; break;
  117.                             case 13: s << "<cr>"; break;
  118.                             case 27: s << "<esc>"; break;
  119.                             default: s << c; break;
  120.                         }
  121.                     } else {
  122.                         s << "<" << hexo << "$" << (unsigned int) c << deco << ">";
  123.                     }
  124.                 }
  125.                 s << "> ";
  126.             }
  127.         }
  128.         
  129.         DescribeSubclass (s);
  130.         
  131.         s << endl;
  132.     }
  133.     return s;
  134. }
  135.  
  136. /***********************************|****************************************/
  137.  
  138. ostream& TRecipient::DescribeSubclass( ostream& s ) const
  139. {
  140.     return s;
  141. }
  142.  
  143. /***********************************|****************************************/
  144.  
  145. //    This probably will never be called
  146. ostream& TRecipient::operator >> ( ostream& s ) const
  147. {
  148.     TRString            name;
  149.     
  150.     if (this == nil) {
  151.         s << "TRecipient: nil" << flush;
  152.         return s;
  153.     }
  154.  
  155.     s << "TRecpt: '";
  156.     if (GetRecipientName (name)) {
  157.         s << name << " ";
  158.     }
  159.     
  160.     s << "' status=" << GetStatus() << flush;
  161.     
  162.     return s;
  163. }
  164.     
  165. /***********************************|****************************************/
  166.  
  167. TRecipient::TRecipient ()
  168. {
  169. }
  170.  
  171. /***********************************|****************************************/
  172.  
  173. TRecipient::~TRecipient ()
  174. {
  175. }
  176.  
  177. /***********************************|****************************************/
  178.  
  179. Boolean TRecipient::GetDirectoryName (DirectoryName&) const 
  180. {
  181.     return false;
  182. }
  183.  
  184. /***********************************|****************************************/
  185.  
  186. unsigned short TRecipient::GetPathNameCount () const 
  187. {
  188.     return 0;
  189. }
  190.  
  191. /***********************************|****************************************/
  192.  
  193. void TRecipient::GetPathNameItem (unsigned short, TRString& ) const
  194. {
  195. }
  196.  
  197. /***********************************|****************************************/
  198.  
  199. Boolean TRecipient::GetPathDNode (unsigned long& ) const 
  200. {
  201.     return false;
  202. }
  203.  
  204. /***********************************|****************************************/
  205.  
  206. Boolean TRecipient::GetCID (CreationID& )  const
  207. {
  208.     return false;
  209. }
  210.